def displaymatrix():
    import tkinter as tk
    linearwindow=tk.Tk()
    linearwindow.title("DisplayMatrix")
    linearwindow.geometry("600x700")
    def lie():
        lie=eval(e2.get())
    def dpm():
        ma=[]
        lie=eval(e2.get())
        ma=eval(e3.get())
        #print(ma)
        for k in ma:
            if len(k) != lie:
                tx.insert('insert',"【错误】列数输入错误或矩阵输入错误！\n")
                return
        for i in ma:
            tx.insert('insert','[ ')
            for j in range(0,len(i)):
                tx.insert('insert',i[j])
                tx.insert('insert',' ')
            tx.insert('insert',']\n')
            
        tx.insert('insert','\n')
    e2 = tk.Entry(linearwindow,font=('Arial', 14))
    e2.pack()
    bt2=tk.Button(linearwindow,text='确认列数',width=10,height=2,font=('Arial', 12),command=lie)
    bt2.pack()
    lb1=tk.Label(linearwindow, text='输入矩阵元素时以[]分隔每行：\nexamp:[[1,2,3],[2,5,6]]', bg='orange', font=('Arial', 12), width=30, height=2)
    lb1.pack()
    e3 = tk.Entry(linearwindow,font=('Arial', 14))
    e3.pack()
    bt3=tk.Button(linearwindow,text='显示矩阵形式',width=10,height=2,font=('Arial', 12),command=dpm)
    bt3.pack()
    tx=tk.Text(linearwindow,width=30,height=30)
    tx.pack()
    linearwindow.mainloop()